package com.lc.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.pojo.*;
import com.guigu.viwe.PageVo;
import com.lc.service.TOrderService;
import com.lc.vo.OrderTmnberView;
import com.lc.vo.checkgroupcheckitemView;
import com.lc.vo.setmealTcheckgroupView;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 预约管理的controller
 */
@RestController
@RequestMapping("/lcorder")
public class TOrderController {

    @Resource
    private TOrderService service;

    @PostMapping("/queryallpageorderlist")
    public PageInfo<OrderTmnberView> queryallpageorderlist(@RequestBody PageVo<OrderTmnberView> pageVo){
        return this.service.queryallpageorderlistService(pageVo);
    }

    /**
     * 查询所有套餐
     * @param pageVo
     * @return
     */
    @PostMapping("/querysetmeal")
    public PageInfo<TSetmeal> querysetmeal(@RequestBody PageVo<TSetmeal> pageVo){
        return this.service.querysetmealService(pageVo);
    }


    /**
     *根据姓名查询会员答案模糊查询
     * @param tMember
     * @return
     */
    @PostMapping("/seachmembername")
    public List<TMember> seachmembername(@RequestBody TMember tMember){
//        System.out.println(tMember.getName());
        return this.service.seachmembernameService(tMember.getName());
    }

    /**
     *根据姓名查询会员档案
     * @param tMember
     * @return
     */
    @PostMapping("/seachmembername1")
    public TMember seachmembername1(@RequestBody TMember tMember){
        return this.service.seachmembername1Service1(tMember.getName());
    }

    /**
     * 預約管理——新增預約
     * @param order
     * @return
     */
    @PostMapping("/addorderlistcontroller")
    public int addorderlistcontroller(@RequestBody TOrder order){
        this.service.insertorderlistService(order);
        return 1;
    }

    /**
     * 預約管理——确定预约发送预约成功的短信
     * @param
     * @return
     */
    @PostMapping("/quedingyuyuecontroller")
    public int quedingyuyuecontroller(@RequestBody OrderTmnberView OrderTmnberView){
        this.service.quedingyuyueService(OrderTmnberView);
        return 1;
    }

    /**
     *預約管理——取消预约给用户发送预约失败的信息
     * @param OrderTmnberView
     * @return
     */
    @PostMapping("/quxaioyuyuecontroller")
    public int quxaioyuyuecontroller(@RequestBody OrderTmnberView OrderTmnberView){
        this.service.quxiaoyuyueService(OrderTmnberView);
        return 1;
    }
    /**
     * 預約設置——查询所有预约设置信息
     */
    @GetMapping("/queryordersettingall")
    public List<TOrdersetting> queryordersettingall(){
      return   this.service.queryordersettingallService();
    }


    /**
     * 預約設置——新增預約設置信息
     * @param tOrdersetting
     * @return
     */
     @PostMapping("/addordersettingcontroller")
    public int addordersettingcontroller(@RequestBody TOrdersetting tOrdersetting){
        this.service.insertTordersettingService(tOrdersetting);
        return 1;
     }

    /**
     * 套餐管理——查詢所有套餐
     * @param pageVo
     * @return
     */
     @PostMapping("/querysetmealallpagecontroller")
    public PageInfo<TSetmeal> querysetmealallpagecontroller(@RequestBody PageVo<TSetmeal> pageVo){
         return this.service.querysetmealallpage(pageVo);
     }

    /**
     * 套餐管理--添加套餐——查询所有检查项
     * @param pageVo
     * @return
     */
     @PostMapping("/querycheckgroupall")
    public List<TCheckgroup> querycheckgroupall(@RequestBody PageVo<TCheckgroup> pageVo){
       return   this.service.querycheckgroupall(pageVo);
     }

    /**
     * 套餐管理--添加套餐--新增检查分组
     * @param view
     * @return
     */
     @PostMapping("/addcheckgroupcontroller")
    public int addcheckgroupcontroller(@RequestBody checkgroupcheckitemView view){
         this.service.addcheckgroupService(view);
         return 1;
     }

    /**
     * 套餐管理——添加套餐
     * @param setmealTcheckgroupView
     * @return
     */
     @PostMapping("/addsetmealortcheckgroup")
    public int addsetmealortcheckgroup(@RequestBody setmealTcheckgroupView setmealTcheckgroupView){
         System.out.println(setmealTcheckgroupView);
         this.service.addsetmealortcheckgroupService(setmealTcheckgroupView);
         return 1;
     }

    /**
     * 预约管理——检查项管理——查询所有的检查项分页
     * @param pageVo
     * @return
     */
     @PostMapping("/queryallcheckitemAllController")
    public PageInfo<TCheckitem> queryallcheckitemAllController(@RequestBody PageVo<TCheckitem> pageVo){
        return this.service.queryallcheckitemAllService(pageVo);
     }

    /**
     * 预约管理——检查组管理——查询所有检查组
     * @param pageVo
     * @return
     */
     @PostMapping("/selectallcheckgroupcontroller")
    public PageInfo<TCheckgroup> selectallcheckgroupcontroller(@RequestBody PageVo<TCheckgroup> pageVo){
         return this.service.selectallcheckgroupService(pageVo);
     }

    /**
     * 检查项-新增
     * @param tCheckitem
     * @return
     */
    @PostMapping("/addcheckitemcontroller")
    public int addcheckitemcontroller(@RequestBody TCheckitem tCheckitem){
        this.service.addcheckitemService(tCheckitem);
        return 1;
    }

    /**
     * 检查项——修改
     * @param tCheckitem
     * @return
     */
    @PostMapping("/updatecheckitemcontroller")
    public int updatecheckitemcontroller(@RequestBody TCheckitem tCheckitem){
        this.service.updatecheckitemService(tCheckitem);
        return 1;
    }

    /**
     * 检查项-删除
     * @param tCheckitem
     * @return
     */
    @PostMapping("/deletecheckitemcontroller")
    public int deletecheckitemcontroller(@RequestBody TCheckitem tCheckitem){
        this.service.deletecheckitemService(tCheckitem);
        return 1;
    }

    /**
     * 查询所有检查项不分类
     * @param pageVo
     * @return
     */
    @PostMapping("/queryallcheckitemallnotpagecontroller")
    public List<TCheckitem> queryallcheckitemallnotpagecontroller(@RequestBody PageVo<TCheckitem> pageVo){
        return this.service.queryallcheckitemallnotpageService(pageVo);
    }

    /**
     * 根据套餐编号查询选择套餐拥有的检查组
     * @param setmealid
     * @return
     */
    @GetMapping("/querycheckzhocheckgroupcontroller")
    public List<TCheckgroup> querycheckzhocheckgroupcontroller(int setmealid){

        return this.service.querycheckzhocheckgroup(setmealid);
    }

    /**
     * 修改套餐
     * @param setmealTcheckgroupView
     * @return
     */
    @PostMapping("/updatesetmealandcheckgroupcontroller")
    public int updatesetmealandcheckgroupcontroller(@RequestBody() setmealTcheckgroupView setmealTcheckgroupView){
        this.service.updatesetmealandcheckgroupService(setmealTcheckgroupView);
        return 1;
    }

    /**
     * 根据检查组编号查询该检查组有的检查项
     * @param id
     * @return
     */
    @GetMapping("/querythischeckgroupyoudecheckitem")
    public List<TCheckitem> querythischeckgroupyoudecheckitem(int id){
        return this.service.querythischeckgroupyoudecheckitemServicce((id));
    }

    /**
     * 修改检查组
     * @param view
     * @return
     */
    @PostMapping("/updatetcheckgroupcontroller")
    public int updatetcheckgroupcontroller(@RequestBody() checkgroupcheckitemView view){
        this.service.updatetcheckgroupService(view);
        return 1;
    }

    @RequestMapping("/selectmemberformnameandidcard")
    public List<TMember> selectmemberformnameandidcard(@RequestBody TMember member){
        return this.service.selectmemberformnameandidcardService(member.getName());
    }

    @GetMapping("/queryordersettingnumbernotresercontroller")
    public List<TOrdersetting> queryordersettingnumbernotresercontroller(){
        return this.service.queryordersettingnumbernotreser();
    }
    /**
     * 验证预约日期
     * 验证预约日期
     */
    @GetMapping("/yanzorderdatecontroller")
    public boolean yanzorderdatecontroller(String date){
      return  this.service.yanzorderdateService(date);
    }


    @PostMapping("/booleanmemberyuyuecontroller")
    public  boolean booleanmemberyuyuecontroller(@RequestBody() TMember member){
     return    this.service.booleanmemberyuyue(member);
    }
}
